cmake_minimum_required(VERSION 3.19)
project(QTalkClient LANGUAGES CXX)

find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets Network Sql)
find_package(Qt6 REQUIRED COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS Core)

set(CMAKE_AUTORCC ON)

qt_standard_project_setup()

qt_add_executable(QTalkClient
    WIN32 MACOSX_BUNDLE
    main.cpp
    widget.cpp
    widget.h
    widget.ui
    loginwindow.h loginwindow.cpp loginwindow.ui
    registerwindow.h registerwindow.cpp registerwindow.ui
    chatwindow.h chatwindow.cpp chatwindow.ui
    tcpclient.h tcpclient.cpp
    clientdatabasemanager.h clientdatabasemanager.cpp
    res.qrc
    addfriendwidget.h addfriendwidget.cpp addfriendwidget.ui
    friendrequestwidget.h friendrequestwidget.cpp friendrequestwidget.ui
    friendrequestitemwidget.h friendrequestitemwidget.cpp friendrequestitemwidget.ui

)

target_link_libraries(QTalkClient
    PRIVATE
        Qt::Core
        Qt::Widgets
        Qt::Network
        Qt::Sql
)
target_link_libraries(QTalkClient PRIVATE Qt6::Core)
target_link_libraries(QTalkClient PRIVATE Qt6::Core)

include(GNUInstallDirs)

install(TARGETS QTalkClient
    BUNDLE  DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

qt_generate_deploy_app_script(
    TARGET QTalkClient
    OUTPUT_SCRIPT deploy_script
    NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
